﻿@{
    ViewBag.Title = "PostList";
    Layout = "~/Views/Shared/_ListLayout.cshtml";
}
@section toolbar{
    <table style="width: 100%;">
        <tr>
            <td style="width: 100%;">
                <a class="mini-button" iconcls="icon-add" onclick="editRow('')" plain="true">增加</a>
                <span class="separator"></span>
            </td>
            <td style="white-space: nowrap;">
                <input id="keyword" class="mini-textbox" emptytext="请输入名称" style="width: 150px;" onenter="onKeyEnter" />
                <a class="mini-button" onclick="search()">查询</a>
            </td>
        </tr>
    </table>
}
@section script
{
    <script type="text/javascript">
        mini.parse();
        function showSearchWindow() {
            var win = mini.get("searchWindow");
            win.show();
        }
        function advSearch() {
            var frm = new mini.Form("frmAdv");
            grid.load(frm.getData(true));
            var win = mini.get("searchWindow");
            win.hide();
        }
        function search() {
            grid.load({
                "id": mini.get("#keyword").value
            });
        }
        function editRow(id) {
            mini.open({
                url: "/Home/BranchPostEdit/" + id,
                title: "分店通知管理",
                iconCls: "icon-user",
                allowResize: false,
                width: 630,
                height: 350,
                onload: function () {
                },
                ondestroy: function (action) {

                    grid.reload();
                }
            });
        }
        function deleteItem(id) {
            $.ajax({
                url: "/Home/BranchPostDelete",
                data: { ids: id },
                success: function (text) {
                    grid.reload();
                },
                error: function () {
                }
            });
        }
    </script>
}
<div id="datagrid1" class="mini-datagrid" url="/Home/GetAllBranchPosts"
    style="width: 100%; height: 100%;" idfield="Id" allowresize="false" sizelist="[20,30,50,100]"
    pagesize="50" multiselect="true">
    <div property="columns">
        <div type="indexcolumn" width="30">
        </div>
        <div type="checkcolumn" width="30">
        </div>
        <div field="Title" headeralign="center" align="center" width="60">标题</div>
        <div field="PostTime" headeralign="center" align="center" width="60"  dateformat="yyyy-MM-dd HH:mm:ss">发布时间</div>
        <div field="PostUser" headeralign="center" align="center" width="60">发布者</div>
        <div name="action" width="120" headeralign="center" align="center" renderer="onActionRenderer" cellstyle="padding:0;">管理</div>
    </div>
</div>